<%@ page language="java" contentType="text/html; charset=UTF-8" %>

<%
    /**
     * 上线以后去掉该部分代码,从2-5行
     */
    StringBuffer names = new StringBuffer();


	/**
	 * 把上一页面的查询条件保存到操作页面来
	 */
	StringBuffer buff = new StringBuffer();
	java.util.Enumeration enum1 = request.getParameterNames(); 
	while(enum1.hasMoreElements())
	{
		String paramName  = (String)enum1.nextElement();
		String paramValue = (String)request.getParameter(paramName);
        
    if(!"action".equals(paramName) && 
			( paramName.startsWith("qry") || "_lastkey_".equals(paramName) ||
                "_key_".equals(paramName) || "currPage".equals(paramName) || "direction".equals(paramName)) ) 
    {
      buff.append("<input type='hidden' name='");
			buff.append(paramName).append("' ");
			buff.append("value='").append(paramValue).append("' >\n");
      names.append("'").append(paramName).append("',");
    }
   }


%>

<script>
    /**
     * 判断一个form中是否存在同名的域,上线以后该js去掉
     */
    function exitField(names)
    {
        var form = document.forms["theForm"];

        var exitField = "";
        for(i=0 ; i < names.length ; i++)
        {
            var field = form[names[i]];
            if(field != "undefine" && field != null) {
                exitField += names[i];
            }
        }

        if(exitField.length > 0) {
            alert(form.id + "中存在和上页相同的域:\n" + exitField);
        }
    }

</script>

<%
    if( names.length() > 0) 
    {
        out.print("<script>exitField([" + names.substring(0 , names.length() - 1) + "]);</script>");
    }
    out.print(buff.toString());
    buff.delete(0 , buff.length());
%>




